import json


class SingleLog:
    dict = {}

    def __init__(self, kind: str, unit: str, number: float, unit_price: float, date: str, mode: int):
        self.dict = {'kind': kind, 'unit': unit, 'number': number, 'unitPrice': unit_price, 'date': date, 'mode': mode}


class SingleLogEncoder(json.JSONEncoder):
    def default(self, obj):
        if isinstance(obj, SingleLog):
            return obj.dict
        return json.JSONEncoder.default(self, obj)
